package thu.cs.segroup.agent.behaviour;

import java.util.List;

import jade.core.AID;
import jade.core.Agent;
import jade.core.behaviours.OneShotBehaviour;
import jade.lang.acl.ACLMessage;

public class CommonSendStrMsgBehav extends OneShotBehaviour {

	private String content;
	private List<String> destination;
	private String conversationId;
	private int tag;
	
	public CommonSendStrMsgBehav(String _content, List<String> _destination, Agent agent, String _conversationId, int _tag) {
		super(agent);
		this.content = _content;
		this.destination = _destination;
		this.conversationId = _conversationId;
		this.tag = _tag;
	}
	
	@Override
	public void action() {
		ACLMessage msg = new ACLMessage(this.tag);
		msg.setContent(content);
		msg.setConversationId(this.conversationId);
		for (int i = 0; i < destination.size(); i++) {
			msg.addReceiver(new AID(destination.get(i), AID.ISLOCALNAME));
		}
		myAgent.send(msg);
	}

}
